CRSisEqualIntFloat Function

private function CRSisEqualIntFloat(mask, grid, checkCells) result(isEqual)

return .TRUE. if the two grids have the same Coordinate Reference System, and the same spatial reference (cellsize, xllxorner, yllcorner, idim, jdim) If checkCells is given the function checks that grid has the same active cells of mask.

Arguments

Type IntentOptional Attributes Name
type(grid_integer), intent(in) :: mask
type(grid_real), intent(in) :: grid
logical, intent(in), optional :: checkCells

Return Value logical


Variables

Type Visibility Attributes Name Initial
integer, public :: i
integer, public :: j

Source Code

FUNCTION CRSisEqualIntFloat &
!
(mask, grid, checkCells) &
!
RESULT (isEqual)

IMPLICIT NONE

! Arguments with intent(in):
TYPE (grid_real), INTENT(IN) :: grid
TYPE (grid_integer), INTENT(IN) :: mask
LOGICAL, OPTIONAL, INTENT(IN) :: checkCells

!Local declarations:
LOGICAL :: isEqual
INTEGER :: i,j
!------------------------end of declaration------------------------------------

IF ( mask % grid_mapping == grid % grid_mapping .AND. &
     mask % cellsize     == grid % cellsize     .AND. &
     mask % xllcorner    == grid % xllcorner    .AND. &
     mask % yllcorner    == grid % yllcorner    .AND. &
     mask % idim         == grid % idim         .AND. &
     mask % jdim         == grid % jdim               ) THEN
   
   isEqual = .TRUE.
   
ELSE
   
   isEqual = .FALSE.
   
END IF

IF ( PRESENT (checkCells) ) THEN
  IF (checkCells) THEN
    DO i = 1, mask % idim
      DO j = 1, mask % jdim
        IF ( mask % mat (i,j) /= mask % nodata .AND. &
             grid % mat (i,j) == grid % nodata  ) THEN
             isEqual = .FALSE.
             EXIT
        END IF
      END DO
    END DO
  END IF
END IF

END FUNCTION CRSisEqualIntFloat